Removing Useless Productions of a Context Free Grammar through Petri Net
نویسندگان
چکیده
Following the proposal for a Petri Net (PN) representation of the Context Free Grammar (CFG), we propose in this paper, an algorithm to eliminate the useless productions of CFG. First the CFG is represented by a PN. Then, based on the reachability, an algorithm is developed to eliminate Useless-productions. The algorithm is analyzed and implemented in Pascal using examples of a CFG. The proposed algorithm is better than the existing techniques in the sense that PN model is easy to understand and requires fewer computations and easily implemented on computers.
منابع مشابه
Petri Net Controlled Grammars: the Power of Labeling and Final Markings∗
Essentially, a Petri net controlled grammar is a context-free grammar equipped with a Petri net and a function which maps transitions of the net to rules of the grammar. The language consists of all terminal words that can be obtained by applying of a sequence of productions which is the image of an occurrence sequence of the Petri net under the function. We study the generative power of such g...
متن کاملPetri Net Controlled Grammars: the Case of Special Petri Nets
A Petri net controlled grammar is a context-free grammar equipped with a Petri net, whose transitions are labeled with rules of the grammar or the empty string, and the associated language consists of all terminal strings which can be derived in the grammar and the the sequence of rules in every terminal derivation corresponds to some occurrence sequence of transitions of the Petri net which is...
متن کاملPetri Net Controlled Grammars with a Bounded Number of Additional Places
A context-free grammar and its derivations can be described by a Petri net, called a context-free Petri net, whose places and transitions correspond to the nonterminals and the production rules of the grammar, respectively, and tokens are separate instances of the nonterminals in a sentential form. Therefore, the control of the derivations in a context-free grammar can be implemented by adding ...
متن کاملPreventing deadlock during anisotropic 2D mesh adaptation in hp-adaptive FEM
The paper presents a grammar for anisotropic two-dimensional mesh adaptation in hp-adaptive Finite Element Method with rectangular elements. It occurs that a straightforward approach to modeling this process via grammar productions leads to potential deadlock in h-adaptation of the mesh. This fact is shown on a Petri net model of an exemplary adaptation. Therefore auxiliary productions are adde...
متن کاملParsing Algorithms for Grammars with Regulated Rewriting
In recent papers [4, 5, 8, 11] Petri net controlled grammars have been introduced and investigated. It was shown that various regulated grammars such as random context, matrix, vector, valence grammars, etc., resulted from enriching context-free grammars with additional mechanisms can be unified into the Petri net formalism, i.e., a grammar and its control can be represented by a Petri net. Thi...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
دوره شماره
صفحات -
تاریخ انتشار 2007